<template>
	<view>
		<view class="cu-form-group ">
			<view class="title">头像</view>
			<view class="flex" @tap="tapAvatar">
				<view class="cu-avatar radius bg-gray" :style="[{backgroundImage:'url('+userInfo.faceImage+')'}]" />
				<view class="cuIcon-right text-gray" style="padding-top: 10upx;"></view>
			</view>
		</view>
		<view class="cu-form-group ">
			<view class="title">昵称</view>
			<view class="flex" @tap="tapNickname">
				<view class="text-gray">{{userInfo.nickname}}</view>
				<view class="cuIcon-right text-gray"></view>
			</view>
		</view>
		<view class="cu-form-group ">
			<view class="title">微信号</view>
			<view class="flex">
				<view class="text-gray">{{userInfo.username}}</view>
				<view class="cuIcon-right text-gray"></view>
			</view>
		</view>
		<view class="cu-form-group ">
			<view class="title">二维码名片</view>
			<view class="flex" @tap="tapQrCode">
				<view class="cuIcon-qrcode text-gray" style="font-size: large;"></view>
				<view class="cuIcon-right text-gray" style="padding-top: 10upx;"></view>
			</view>
		</view>
		<view class="padding flex flex-direction">
		
			<button class="cu-btn bg-red margin-tb-sm lg" @tap="logOut">退出登录</button>
	
		</view>
	</view>
</template>

<script>
	export default {
		onShow() {
			this.userInfo = this.$tool.getStorageSync("userInfo")
		},
		data() {
			return {
				userInfo: {}
			}
		},
		methods: {
			// 退出登录
			logOut() {
				uni.removeStorageSync("userInfo")
				this.$tool.WEBSOCKET.close() // 关闭 websocket
				this.$tool.WEBSOCKET = null
				uni.reLaunch({
					url:'../user/login'
				})
			},
			// 点击头像
			tapAvatar() {
				uni.navigateTo({
					url:'../user/myFace'
				})
			},
			tapNickname() {
				uni.navigateTo({
					url:`../user/nickname?nickname=${this.userInfo.nickname}`
				})
			},
			tapQrCode() {
				uni.navigateTo({
					url:`../user/qrCode`
				})
			}
		}
	}
</script>

<style>

</style>
